#include "io.hpp"



io_system::io_system()
{
	SDL_Init(SDL_INIT_EVERYTHING);
}

io_system::~io_system()
{
	if( this->p_screen ){
		SDL_FreeSurface(this->p_screen);
	}
	if( this->p_swap ){
		SDL_FreeSurface(this->p_swap);
	}

	SDL_Quit();
}

void io_system::create_screen()
{
	/*TODO: Add OGL code */
	this->p_screen = SDL_SetVideoMode( 1040, 600, 32, SDL_SWSURFACE|SDL_DOUBLEBUF );
	SDL_WM_SetCaption("vortex project", "vortex project");
	SDL_FillRect(this->p_screen, NULL, 0x333333);
}

int io_system::parse_input()
{
	SDL_Event event;
	while( SDL_PollEvent(&event))
	{
		switch(event.type)
		{
		case SDL_QUIT:
			return 1;
		case SDL_KEYDOWN:
			return 0;
		case SDL_KEYUP:
			return 0;
		}
	}
	return 0;
}
